home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
CRS
/
crs55.d81
/
change.c
< prev
next >
Wrap
Text File
|
2009-10-10
|
4KB
|
189 lines
#IFDEF ╙╒╨┼╥├
#INCLUDE "H:STDIO.H"
#ELSE
#INCLUDE "STDIO.H"
#ENDIF
MAIN()
█
INT CHANGE;
FLOAT TOTALñCHANGE;
FLOAT COST;
FLOAT AMOUNT;
INT PENNYñC;
INT FIVEñC;
INT TENñC;
INT TWENTYñFIVEñC;
INT ONEñD;
INT TWOñD;
INT FIVEñD;
INT TENñD;
INT TWENTYñD;
INT FIFTYñD;
CHAR KEYPRESS;
/* ╔NSTRUCTIONS */
PRINTF("\223 ├HANGE ╨ROGRAM\N\N\N");
PRINTF(" ╘HIS PROGRAM ASKS YOU TO ENTER THE AMOUNT OF A PURCHASE AND THE\N");
PRINTF("AMOUNT GIVEN TO PAY FOR IT. ╘HE COMPUTER WILL THEN CALCULATE A\N");
PRINTF("BREAKDOWN OF THE MONEY THAT YOU WILL GET BACK FOR CHANGE. ╦EEP IN\N");
PRINTF("MIND THE FOLLOWING RULES THAT YOU HAVE TO FOLLOW WHEN RUNNING THE\N");
PRINTF("PROGRAM:\N\N");
PRINTF(" 1) ─╧╬'╘ INCLUDE DOLLAR SIGNS WHEN ANSWERING THE QUESTIONS.\N");
PRINTF(" 2) ┴NSWER QUESTIONS BY TYPING THE AMOUNTS WITH DECIMALS.\N");
PRINTF(" EG. 50.00 ╬╧╘ 50\N\N\N");
PRINTF("╠ITTLE EXAMPLES BESIDE THE PROMPTS WILL AID YOU IN CASE YOU FORGET\N");
PRINTF("THESE INSTRUCTIONS.\N\N\N");
PRINTF("╨RESS <╥┼╘╒╥╬> TO CONTINUE... ");
SCANF("%C",&KEYPRESS);
/* ─ATA ┼NTRY */
PRINTF("\223┼NTER AMOUNT OF THE PURCHASE ( ╠IKE THIS: 50.00 ): ");
SCANF("%F",&COST);
IF (COST<1.00)
█
DO
█
PRINTF("\N╔TEMS THAT ARE LESS THAN $1.00 AREN'T ALLOWED. ╘RY AGAIN.\N\N");
PRINTF("┼NTER THE AMOUNT OF THE PURCHASE ( ╠IKE THIS: 50.00 ): ");
SCANF("%F",&COST);
▌
WHILE (COST<1.00);
▌
IF (COST >100.00)
█
DO
█
PRINTF("\N╘HE AMOUNT OF PURCHASE CANNOT BE OVER $100.00. ╘RY AGAIN.\N\N");
PRINTF("┼NTER AMOUNT OF THE PURCHASE ( ╠IKE THIS: 50.00 ): ");
SCANF("%F",&COST);
▌
WHILE (COST>100.00);
▌
PRINTF("\N\N┼NTER THE AMOUNT GIVEN FOR THE PURCHASE ( ╠IKE THIS: 50.00 ): ");
SCANF("%F",&AMOUNT);
IF (AMOUNT>100.00)
█
DO
█
PRINTF("\N╘HE AMOUNT GIVEN FOR THE PURCHASE CANNOT BE OVER $100.00.\N\N");
PRINTF("┼NTER AMOUNT GIVEN FOR PURCHASE ( ╠IKE THIS: 50.00 ): ");
SCANF("%F",&AMOUNT);
▌
WHILE (AMOUNT >100.00);
▌
IF (AMOUNT<COST)
█
DO
█
PRINTF("\223╘HE AMOUNT GIVEN IS LESS THAN THE AMOUNT OF THE ITEM.\N\N");
PRINTF("┼NTER THE AMOUNT GIVEN FOR PURCHASE (╠IKE THIS: 50.00 ): ");
SCANF("%F",&AMOUNT);
▌
WHILE (AMOUNT<COST);
▌
TOTALñCHANGE=(AMOUNT-COST);
/* ╨RINT ╙CREEN ╚EADER */
PRINTF("\223");
PRINTF("*******************************************************************\N");
PRINTF("* *\N");
PRINTF("* ├HANGE ┬REAKDOWN ╨ROGRAM *\N");
PRINTF("* *\N");
PRINTF("*******************************************************************\N");
PRINTF("\N\N");
CHANGE=((AMOUNT-COST)*100)+0.05;
PRINTF("┴MOUNT PAID: $%5.2F\N",AMOUNT);
PRINTF("├OST OF ITEM: $%5.2F\N",COST);
PRINTF("\N\N");
IF (CHANGE>=5000)
█
FIFTYñD=CHANGE/5000;
CHANGE=CHANGE % 5000;
PRINTF("┘OU RECEIVE %D FIFTY DOLLAR BILL(S)\N",FIFTYñD);
▌
IF (CHANGE>=2000)
█
TWENTYñD=CHANGE/2000;
CHANGE=CHANGE % 2000;
PRINTF("┘OU RECEIVE %D TWENTY DOLLAR BILL(S)\N",TWENTYñD);
▌
IF (CHANGE>=1000)
█
TENñD=CHANGE/1000;
CHANGE=CHANGE % 1000;
PRINTF("┘OU RECEIVE %D TEN DOLLAR BILL(S)\N",TENñD);
▌
IF (CHANGE>=500)
█
FIVEñD=CHANGE/500;
CHANGE=CHANGE % 500;
PRINTF("┘OU RECEIVE %D FIVE DOLLAR BILL(S)\N",FIVEñD);
▌
IF (CHANGE>=200)
█
TWOñD=CHANGE/200;
CHANGE=CHANGE % 200;
PRINTF("┘OU RECEIVE %D TWO DOLLAR BILL(S)\N",TWOñD);
▌
IF (CHANGE>=100)
█
ONEñD=CHANGE/100;
CHANGE=CHANGE % 100;
PRINTF("┘OU RECEIVE %D ONE DOLLAR BILL(S)\N",ONEñD);
▌
IF (CHANGE>=25)
█
TWENTYñFIVEñC=CHANGE/25;
CHANGE=CHANGE % 25;
PRINTF("┘OU RECEIVE %D QUARTER(S)\N",TWENTYñFIVEñC);
▌
IF (CHANGE>=10)
█
TENñC=CHANGE/10;
CHANGE=CHANGE % 10;
PRINTF("┘OU RECEIVE %D DIME(S)\N",TENñC);
▌
IF (CHANGE>=5)
█
FIVEñC=CHANGE/5;
CHANGE=CHANGE % 5;
PRINTF("┘OU RECEIVE %D NICKEL(S)\N",FIVEñC);
▌
IF (CHANGE>=1)
█
PENNYñC=CHANGE/1;
CHANGE=CHANGE % 1;
PRINTF("┘OU RECEIVE %D PENNY(IES)\N",PENNYñC);
▌
PRINTF("\N┘OUR TOTAL CHANGE AMOUNT IS $%6.2F\N\N",TOTALñCHANGE);
PRINTF("╨RESS ANY KEY TO CONTINUE... ");
SCANF("%C",&KEYPRESS);
▌